﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>输出Table演示</title>
     <title>驰骋工作流</title>
    <script type="text/javascript" src="/WF/Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="/WF/Scripts/QueryString.js" type="text/javascript"></script>
    <link href="/DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="/WF/Scripts/config.js"></script>
    <script type="text/javascript" src="/WF/Comm/Gener.js"></script>
    <script type="text/javascript" language="javascript">

        //页面启动函数.
        $(function () {

            var frmID = GetQueryString("FK_MapData");
            if (frmID == null)
                frmID = "ND101";

            //加载表单字段。
            var mapAttrs = new Entities("BP.Sys.MapAttrs");
            mapAttrs.Retrieve("FK_MapData",  frmID);

            for (var i = 0; i < mapAttrs.length; i++) {
                var mapAttr = mapAttrs[i];

                var html = "<tr>";
                html += "<td>" + (i + 1) + "</td>";
                html += "<td><label><input type=checkbox id='CB_" + mapAttr.KeyOfEn + "' name='" + mapAttr.KeyOfEn + "'/>" + mapAttr.KeyOfEn + "-" + mapAttr.Name + "</label></td>";
                html += "<td>" + mapAttr.Name + "</td>";
                html += "<td>" + mapAttr.MyDataType + "</td>";
                html += "<td><a href=\"javascript:Del('" + mapAttr.MyPK + "');\" ><img src='/WF/Img/Btn/Delete.png' />删除</a></td>";
                html += "</tr>";
                $("#Table1").append(html);
            }

        });

        function Del(mypk) {

            if (window.confirm('您确定要删除吗？') == false)
                return;

            var en = new Entity("BP.Sys.MapAttr", mypk);

            alert("删除成功");
            window.location.href = window.location.href;
        }

        function DelAll() {
            if (window.confirm('您确定要删除选择的数据吗？') == false)
                return;
        }
        //选择与取消选择.
        function CheckAll(checked) {

            //获取type=checkbox的复选框 遍历输出复选框
            var checkeds = $("input[type='checkbox']");
            for (var i = 0; i < checkeds.length; i++) {
                checkeds[i].checked = checked;
            }
        }
    </script>
</head>
<body>

<table id="Table1">
<caption>列表输出演示...</caption>
<tr>
<th>序</th>
<th> <label><input type="checkbox" id="SelectAll"  onclick="CheckAll(this.checked);" >选择要操作的字段</label> </th>
<th>名称</th>
<th>类型</th>
<th>操作</th>
</tr>
</table>
<input type="button"  value="批量删除" onclick="DelAll();"/>

</body>
</html>
